package com.first.core.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;

/**
 * 系统基础参数读取类（从配置文件中读取基础参数）
 * @author jonny
 *
 */
public class SmsContents {
	
	static Logger log = Logger.getLogger(SmsContents.class.getName());
	
	private static Properties properties;
	
	static{
		try{
			initSmsContents();
		}catch (IOException e) {
			log.error("init smscontents error：" + e.getMessage());
		}
	}
	
	/**
	 * 初始化properties
	 * @throws IOException
	 */
	public static void initSmsContents() throws IOException{
		InputStream in = SmsContents.class.getResourceAsStream("/smscontents.properties");
		properties = new Properties();
		properties.load(in);
		log.debug("init smscontents ... ...");
	}
	
	/**
	 * 用户注册验证码短信内容
	 * @param vercode	要发送验证码
	 * @return
	 */
	public static String getRegVercode(String vercode){
		String content = properties.getProperty("reg_vercode");
		return content.replace("${vercode}", vercode);
	}
	
	/**
	 * 用户资料审核通过短信内容
	 * @param tradeAccId	要发送的交易商账号
	 * @return
	 */
	public static String getVerified(String tradeAccId){
		String content = properties.getProperty("verified");
		return content.replace("${tradeAccId}", tradeAccId);
	}
	
	/**
	 * 银行签约成功
	 * @return
	 */
	public static String getSignSuccess(){
		return properties.getProperty("sign_success");
	}
	
	
	/**
	 * 测试方法
	 * @param args
	 */
	public static void main(String[] args){
		System.out.println(getVerified("11325235"));
	}
}